package com.aabte.design2.behavioral.chain.v3;

import java.util.Collection;
import java.util.LinkedList;

/**
 * 容器可以将简单组件和其他容器作为其子项目。链关系将在这里建立。该类将从
 * 其父类处继承 showHelp（显示帮助）的行为。
 *
 * @author Daniel
 */
public class Container extends Component {

    protected Collection<Component> children = new LinkedList<>();

    public Container() {
    }


    public Container(int x, int y, int width, int height) {
        super(x, y, width, height);
    }

    public void add(Component child) {
        this.children.add(child);
        child.container = this;
    }

}


